Skip to content

Conversation

@jimmymadon
Copy link
Collaborator

Summary

Addresses issue:

Relevant technical choices

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 7.4.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.
  • Ensure there are no unexpected significant changes to file sizes.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@github-actions
Copy link

Storybook is ready:

@github-actions
Copy link

Build files for 3e286ab are ready:

@github-actions
Copy link

Size Change: +459 B (+0.02%)

Total Size: 2.19 MB

ℹ️ View Unchanged
Filename Size Change
./dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.css 124 B 0 B
./dist/assets/blocks/reader-revenue-manager/block-editor-plugin/editor-styles.js 20 B 0 B
./dist/assets/blocks/reader-revenue-manager/block-editor-plugin/index.js 42.7 kB 0 B
./dist/assets/blocks/reader-revenue-manager/common/editor-styles.css 307 B 0 B
./dist/assets/blocks/reader-revenue-manager/common/editor-styles.js 20 B 0 B
./dist/assets/blocks/reader-revenue-manager/contribute-with-google/index.js 5.88 kB 0 B
./dist/assets/blocks/reader-revenue-manager/contribute-with-google/non-site-kit-user.js 5.07 kB 0 B
./dist/assets/blocks/reader-revenue-manager/subscribe-with-google/index.js 5.88 kB 0 B
./dist/assets/blocks/reader-revenue-manager/subscribe-with-google/non-site-kit-user.js 5.07 kB 0 B
./dist/assets/blocks/sign-in-with-google/editor-styles.css 84 B 0 B
./dist/assets/blocks/sign-in-with-google/editor-styles.js 20 B 0 B
./dist/assets/blocks/sign-in-with-google/index.js 18.6 kB 0 B
./dist/assets/css/googlesitekit-admin-css-********************.min.css 64.5 kB +16 B (+0.02%)
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.7 kB 0 B
./dist/assets/css/googlesitekit-authorize-application-css-********************.min.css 846 B 0 B
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 8.57 kB 0 B
./dist/assets/js/146-********************.js 963 B 0 B
./dist/assets/js/201-********************.js 2.85 kB 0 B
./dist/assets/js/314-********************.js 100 kB 0 B
./dist/assets/js/315-********************.js 3.08 kB 0 B
./dist/assets/js/379-********************.js 3.7 kB 0 B
./dist/assets/js/590-********************.js 1.89 kB 0 B
./dist/assets/js/640-********************.js 2.36 kB 0 B
./dist/assets/js/909-********************.js 1.01 kB 0 B
./dist/assets/js/analytics-advanced-tracking-********************.js 475 B 0 B
./dist/assets/js/googlesitekit-activation-********************.js 24.1 kB 0 B
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 54.9 kB 0 B
./dist/assets/js/googlesitekit-adminbar-********************.js 34.5 kB 0 B
./dist/assets/js/googlesitekit-api-********************.js 7.79 kB 0 B
./dist/assets/js/googlesitekit-block-tracking-********************.js 5.51 kB 0 B
./dist/assets/js/googlesitekit-components-********************.js 5.74 kB 0 B
./dist/assets/js/googlesitekit-consent-mode-********************.js 25.5 kB 0 B
./dist/assets/js/googlesitekit-data-********************.js 1.7 kB 0 B
./dist/assets/js/googlesitekit-datastore-forms-********************.js 6.99 kB 0 B
./dist/assets/js/googlesitekit-datastore-location-********************.js 1.51 kB 0 B
./dist/assets/js/googlesitekit-datastore-site-********************.js 17.4 kB +88 B (+0.51%)
./dist/assets/js/googlesitekit-datastore-ui-********************.js 7.11 kB 0 B
./dist/assets/js/googlesitekit-datastore-user-********************.js 22.8 kB 0 B
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 61.7 kB 0 B
./dist/assets/js/googlesitekit-events-provider-contact-form-7-********************.js 1.77 kB 0 B
./dist/assets/js/googlesitekit-events-provider-easy-digital-downloads-********************.js 745 B 0 B
./dist/assets/js/googlesitekit-events-provider-mailchimp-********************.js 1.77 kB 0 B
./dist/assets/js/googlesitekit-events-provider-ninja-forms-********************.js 1.69 kB 0 B
./dist/assets/js/googlesitekit-events-provider-optin-monster-********************.js 1.72 kB 0 B
./dist/assets/js/googlesitekit-events-provider-popup-maker-********************.js 1.79 kB 0 B
./dist/assets/js/googlesitekit-events-provider-woocommerce-********************.js 1.13 kB 0 B
./dist/assets/js/googlesitekit-events-provider-wpforms-********************.js 1.77 kB 0 B
./dist/assets/js/googlesitekit-i18n-********************.js 6.16 kB 0 B
./dist/assets/js/googlesitekit-key-metrics-setup-********************.js 46.6 kB 0 B
./dist/assets/js/googlesitekit-main-dashboard-********************.js 135 kB 0 B
./dist/assets/js/googlesitekit-metric-selection-********************.js 52.7 kB 0 B
./dist/assets/js/googlesitekit-modules-********************.js 19.9 kB 0 B
./dist/assets/js/googlesitekit-modules-ads-********************.js 47.6 kB 0 B
./dist/assets/js/googlesitekit-modules-adsense-********************.js 133 kB 0 B
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 187 kB 0 B
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 23.5 kB 0 B
./dist/assets/js/googlesitekit-modules-reader-revenue-manager-********************.js 43.6 kB 0 B
./dist/assets/js/googlesitekit-modules-search-console-********************.js 65.2 kB 0 B
./dist/assets/js/googlesitekit-modules-sign-in-with-google-********************.js 34.4 kB 0 B
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 30 kB 0 B
./dist/assets/js/googlesitekit-notifications-********************.js 60.9 kB 0 B
./dist/assets/js/googlesitekit-polyfills-********************.js 230 B 0 B
./dist/assets/js/googlesitekit-settings-********************.js 125 kB +355 B (+0.29%)
./dist/assets/js/googlesitekit-splash-********************.js 73.5 kB 0 B
./dist/assets/js/googlesitekit-user-input-********************.js 46 kB 0 B
./dist/assets/js/googlesitekit-vendor-********************.js 322 kB 0 B
./dist/assets/js/googlesitekit-widgets-********************.js 104 kB 0 B
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 60 kB 0 B
./dist/assets/js/runtime-********************.js 1.93 kB 0 B

compressed-size-action

Copy link
Collaborator

@zutigrm zutigrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jimmymadon looking good in overall, I left you few comments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can complete the coverage by including two more cases to verify that notice is not showing in these scenarios:

  • does not render when Analytics is active
  • does not render if Analytics was once connected

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually preload settings, it will be beneficial to include new route to the googlesitekit_apifetch_preload_paths hook together with existing /core/user/data/email-reporting-settings prefetched route

$this->settings = $settings;
public function __construct( Email_Reporting_Settings $settings, Options $options ) {
$this->settings = $settings;
$this->was_analytics_4_connected = new Was_Analytics_4_Connected( $options );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the best place to instantiate the Was_Analytics_4_Connected, we should instantiate it in the constructor of Google\Site_Kit\Core\Email_Reporting\Email_Reporting and pass it as DI to the REST_Email_Reporting_Controller when instantiating it, so only an instance is received and set as class property here

* @access private
* @ignore
*/
class Was_Analytics_4_Connected extends Setting {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets include get_default method to return false by default to value is always returned/set and get_sanitize_callback with return 'boolval' to have established pattern of sanitising fields on save

Comment on lines +545 to +546
$was_analytics_4_connected = new Was_Analytics_4_Connected( $this->options );
$was_analytics_4_connected->set( true );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I like the simplified approach by marking the settings directly on deactivation instead of listening to the settings change, instantiating Email_Reporting settings cross namespace this way isn't the best design. I would propose we create a new action here, for example do_action('googlesitekit_analytics_4_on_deactivation') or something similar and then hook into it from Google\Site_Kit\Core\Email_Reporting\Email_Reporting::register where Was_Analytics_4_Connected instance is already set.

I would like to get @eugene-manuilov thoughts on this too before we add a new hook here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants